package cn.calin.day05.demo48Exception;

import java.util.Objects;

public class Demo04Objects {
    public static void main(String[] args) {
        method(null);
    }

    private static void method(Object obj) {
        //对传递过来的参数进行合法性判断，判断是否为null
        /*if (obj==null){
            throw new NullPointerException("传递的对象的值是null");
        }*/
        //Objects.requireNonNull(obj)
        Objects.requireNonNull(obj,"传递的对象的值是null");//
    }
}
